package com.junjie.blibli.dao;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junjie.blibli.Entity.RefreshTokenDetail;
import com.junjie.blibli.Entity.User;
import com.junjie.blibli.Entity.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface UserDao{
    User getUserByPhone(String phone);

    Integer addUser(User user);

    void addUserInfo(UserInfo userInfo);

    User getUserById(Long userId);

    UserInfo getUserInfoById(Long userId);

    Integer updateUserInfos(UserInfo userInfo);

    List<UserInfo> getUserInfoByIds(Set<Long> userIdList);

    Integer pageCountUserInfos(Map<String,Object> params);

    List<UserInfo> pageListUserInfos(JSONObject params);

    void deleteRefreshToken(@Param("refreshToken") String refreshToken,
                            @Param("userId")Long dbUserId);

    void addRefreshToken(@Param("refreshToken") String refreshToken,
                         @Param("userId")Long dbUserId,
                         @Param("createTime")Date createTime);

    RefreshTokenDetail getRefreshTokenDetail(String refreshToken);

    List<UserInfo> batchGetUserInfoByUserIds(@Param("userIdList") Set<Long> userIdList);

}
